package javafx.MyDemo;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.application.Preloader;
import javafx.collections.ObservableList;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Popup;
import javafx.stage.PopupWindow;
import javafx.stage.Stage;

public class FXPopupWindow extends Popup {
	
//	sizeToScene()
//	Set the width and height of this Window to match the size of the content of this Window's Scene.
	
	public FXPopupWindow(Stage primaryStage){
		super();
		ObservableList<Node> content = this.getContent();
		
		Button fxbtn1 = new Button("PupUp1");
		Button fxbtn2 = new Button("PupUp2");
		Button fxbtn3 = new Button("PupUp3");
		Label infoLabel = new Label("PopUp");
		
		AnchorPane pane = new AnchorPane();
		pane.setPrefSize(200, 180);
		pane.getChildren().addAll(fxbtn1,fxbtn2,fxbtn3,infoLabel);
		pane.setStyle("-fx-background-color:#dadada;");
		
		fxbtn1.setLayoutX(10);
		fxbtn1.setLayoutY(10);
		
		fxbtn2.setLayoutX(60);
		fxbtn2.setLayoutY(10);
		
		fxbtn3.setLayoutX(10);
		fxbtn3.setLayoutY(60);
		
		infoLabel.setLayoutX(60);
		infoLabel.setLayoutY(60);
		
		content.add(pane);
		
		this.setOpacity(0.7);
		this.show(primaryStage);
	}
	
	
	public static void main(String[] args) {
		Platform.runLater(new Runnable() {
			public void run() {
				new FXPopupWindow(null);
			}
		});
	}
}
